home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cserial / printer.c < prev    next >
C/C++ Source or Header  |  1990-04-04  |  957b  |  41 lines

  1. /*
  2.  *                             PRINTER.C
  3.  *
  4.  *                           Written for the
  5.  *
  6.  *                              Datalight
  7.  *                           Microsoft V 5.x
  8.  *                                TurboC
  9.  *                                  &
  10.  *                               Zortech
  11.  *
  12.  *                             C Compilers
  13.  *
  14.  *            Copyright (c) John Birchfield 1987, 1988, 1989
  15.  *
  16.  * Output a character to the printer port using software interrupt
  17.  * 0x17.  Returns -1 if unsuccessful, 0 otherwise.
  18.  *
  19.  * Usage while (print_char (ch));
  20.  */
  21. #include <dos.h>
  22. #include "printer.h"
  23.  
  24. int 
  25. print_char (ch)
  26. char    ch;
  27. {
  28.     char    flag;
  29.     union REGS regs;
  30.  
  31.     regs.x.dx = 0;
  32.     regs.h.ah = 2;
  33.     int86 (0x17, ®s, ®s);
  34.     if (regs.h.ah != PR_SELECTED)
  35.         return regs.h.ah;
  36.     regs.x.dx = regs.h.ah = 0;
  37.     regs.h.al = ch;
  38.     int86 (0x17, ®s, ®s);
  39.     return 0;
  40. }
  41.